<template>
  <a-modal v-model="visible" :width="1180" :footer="null" title="直播间信息">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="直播间ID">
              <span>{{record.roomId}}</span>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="直播间名称">
              <span>{{record.name}}</span>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="直播间状态">
              <span v-if="record.liveStatus==101">直播中</span>
              <span v-if="record.liveStatus==102">未开始</span>
              <span v-if="record.liveStatus==103">已结束</span>
              <span v-if="record.liveStatus==104">禁播</span>
              <span v-if="record.liveStatus==105">暂停</span>
              <span v-if="record.liveStatus==106">异常</span>
              <span v-if="record.liveStatus==107">已过期</span>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="主播名称">
              <span>{{record.anchorName}}</span>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="计划开播时间">
              <span>{{record.startTime|timestampToTime1}}</span>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="计划结束时间">
              <span>{{record.endTime|timestampToTime1}}</span>
            </a-form-item>
          </a-col>

        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- table区域-begin -->
    <div>

      <a-table ref="table" size="middle" bordered rowKey="id" :columns="columns" :dataSource="record.goods" class="j-table-force-nowrap">

        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="text" @click="openUrlView(text)" height="120px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;" />
        </template>
        <template slot="price" slot-scope="text">
          <div>{{Number(text)/1000}}</div>
        </template>

        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
          <a-button v-else :ghost="true" type="primary" icon="download" size="small" @click="downloadFile(text)">
            下载
          </a-button>
        </template>

        <span slot="action" slot-scope="text, record">
          <a v-if="selectionType=='radio'&&record.activeStatus==1" @click="selectItem(record)">选择</a>
        </span>

      </a-table>
    </div>

  </a-modal>
</template>

<script>

import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import JDictSelectTag from '@/components/dict/JDictSelectTag.vue'

export default {
  name: 'GmsGoodLibList',
  mixins: [mixinDevice],
  components: {
    JDictSelectTag,
  },
  data () {
    return {
      visible: false,
      description: '商品列表',
      // 表头
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: "center",
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '商品图片',
          align: "left",
          dataIndex: 'coverImg',
          scopedSlots: { customRender: "imgSlot" }
        },
        {
          title: '商品标题',
          align: "left",
          dataIndex: 'name'
        },
        {
          title: '售价（元）',
          align: "center",
          dataIndex: 'price',
          scopedSlots: { customRender: "price" }
        }
      ],
      dictOptions: {},
      record: {
        goods: []
      }
    }
  },
  created () {
  },
  computed: {
    importExcelUrl: function () {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    },
  },
  methods: {
    open (record) {
      this.record = record
    },
    initDictConfig () {
    }
  }
}
        </script>
<style scoped>
@import '~@assets/less/common.less';
</style>
